<?php
namespace Home\Controller;
use Think\Controller;
class FormController extends Controller {
     public function index(){
          $db = M('Form');
          $result = $db->select();
          $this->assign('list',$result);
          $this->display();
     }
     public function add(){
          $this->display();
     }

     public function insert(){
          $code =I('post.vcode');
          $Verify = new \Think\Verify();
          $ret = $Verify->check($code);
          if(!$ret){
               $this->error('验证码错误');
          }
     	$db = M('Form');
     	$data['title'] = I('post.title');
     	$data['content'] = I('post.content');
     	$data['create_time'] = time();
     	$db->add($data);
     }

     public function del($id=0){
          $db = M('data');
          $ret = $db->delete($id);
          if($ret===flase){
               echo"error!";
          }else{
               echo"影响了：行" .  $ret;
          }
     }

     public function vcode(){
          $config  = array(
              'fontSize' => 30,
               'length'      =>    4,
              'useNoise' => false,
              'useImgBg' => false,
               );
          //$verify = new \Think\verify($config);
          //$verify->entry();
          $Verify = new \Think\Verify();
          $Verify->entry();
     }

   
}

